package com.ruoyi.ams.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.ams.domain.AmsAssetRequisition;
import com.ruoyi.ams.mapper.AmsAssetRequisitionMapper;
import com.ruoyi.ams.service.IAmsAssetRequisitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资产领用退库Service业务层处理
 * 
 * @author yfkj
 * @date 2022-05-16
 */
@Service
public class AmsAssetRequisitionServiceImpl extends ServiceImpl<AmsAssetRequisitionMapper, AmsAssetRequisition>  implements IAmsAssetRequisitionService
{
    @Autowired
    private AmsAssetRequisitionMapper amsAssetRequisitionMapper;

    /**
     * 查询资产领用退库
     * 
     * @param requisitionId 资产领用退库主键
     * @return 资产领用退库
     */
    @Override
    public AmsAssetRequisition selectAmsAssetRequisitionByRequisitionId(Long requisitionId)
    {
        return amsAssetRequisitionMapper.selectAmsAssetRequisitionByRequisitionId(requisitionId);
    }

    /**
     * 查询资产领用退库列表
     * 
     * @param amsAssetRequisition 资产领用退库
     * @return 资产领用退库
     */
    @Override
    public List<AmsAssetRequisition> selectAmsAssetRequisitionList(AmsAssetRequisition amsAssetRequisition)
    {
        return amsAssetRequisitionMapper.selectAmsAssetRequisitionList(amsAssetRequisition);
    }

    /**
     * 新增资产领用退库
     * 
     * @param amsAssetRequisition 资产领用退库
     * @return 结果
     */
    @Override
    public int insertAmsAssetRequisition(AmsAssetRequisition amsAssetRequisition)
    {
        amsAssetRequisition.setCreateTime(System.currentTimeMillis());
//        amsAssetRequisition.setCreateBy(SecurityUtils.getUsername());
        return amsAssetRequisitionMapper.insertAmsAssetRequisition(amsAssetRequisition);
    }

    /**
     * 修改资产领用退库
     * 
     * @param amsAssetRequisition 资产领用退库
     * @return 结果
     */
    @Override
    public int updateAmsAssetRequisition(AmsAssetRequisition amsAssetRequisition)
    {
        amsAssetRequisition.setUpdateTime(System.currentTimeMillis());
//        amsAssetRequisition.setUpdateBy(SecurityUtils.getUsername());

        return amsAssetRequisitionMapper.updateAmsAssetRequisition(amsAssetRequisition);
    }

    /**
     * 批量删除资产领用退库
     * 
     * @param requisitionIds 需要删除的资产领用退库主键
     * @return 结果
     */
    @Override
    public int deleteAmsAssetRequisitionByRequisitionIds(Long[] requisitionIds)
    {
        return amsAssetRequisitionMapper.deleteAmsAssetRequisitionByRequisitionIds(requisitionIds);
    }

    /**
     * 删除资产领用退库信息
     * 
     * @param requisitionId 资产领用退库主键
     * @return 结果
     */
    @Override
    public int deleteAmsAssetRequisitionByRequisitionId(Long requisitionId)
    {
        return amsAssetRequisitionMapper.deleteAmsAssetRequisitionByRequisitionId(requisitionId);
    }
}
